eMMC Boot Configuration

Previously we were using TF card boot, which corresponds to the hardware interface SD0. Now to change the boot method and boot the system from eMMC, some modifications need to be made to the previous configuration:

Modify Vivado Configuration

In Vivado's block design, enable SD1 (eMMC is mounted on the SD1 interface on the core board):

image-20250723112004925

Continue with the subsequent operations: "Generate Bitstream" --> "Export Hardware" --> Export the .xsa file.

image-20250723113840031

Partition the qspi-flash:

image-20250723121624296

image-20250723120256821

image-20250723114031252

Load uboot and image from QSPI-Flash, load rootfs from eMMC

(1) Burn BOOT.bin: select BOOT.bin as the image file, fill in offset 0x0000000.

(2) Burn image.ub: first rename image.ub to image.ub.bin; then select image.ub.bin as the image file, fill in offset 0x5A0000.

(3) Burn boot.src: first rename boot.src to boot.src.bin; then select boot.src.bin as the image file, fill in offset 0xFE0000:

After uboot starts, it will load the boot.src script. In this script, it will perform corresponding reading, loading, and bootm based on the current boot mode.

image-20250725173954062

boot.src File Analysis

After U-Boot starts, it loads the boot.src script. This script performs corresponding read, load, and bootm operations based on the current boot mode.

The following is the content of the default boot.src file:

If the boot mode is qspi, both U-Boot and the image will be loaded from qspi flash.

If the boot mode is mmc0 or mmc1, both U-Boot and the image will be loaded from mmc.

Loading U-Boot from QSPI-Flash, Loading Image and Rootfs from eMMC

Based on the previous analysis of the boot.src file, if you want to load U-Boot from qspi flash and load the image from mmc, you need to modify the boot.src file.

Because the boot.src file itself has CRC verification, directly modifying the boot.src content will cause boot.src verification to fail, thus preventing the kernel from starting.

boot.src is generated from the template components/yocto/layers/meta-xilinx/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.generic, so you can modify the boot.cmd.generic file.

However, the boot.cmd.generic file may be automatically overwritten during petalinux-config.

A reasonable modification method is to add a u-boot-zynq-scr.bbappend file and a u-boot-zynq-scr folder in project-spec/meta-user/recipes-bsp/uboot/.

Patching U-Boot boot script in Petalinux 2021.1

image-20250725174553471

Copy the components/yocto/layers/meta-xilinx/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.generic file to the u-boot-zynq-scr folder, then modify this file: